home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
RESOURCE
/
JKMRES.GOO
/
cog_weap_flash_m.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
9KB
|
342 lines
# Jedi Knight Missions Cog Script
#
# WEAP_FLASH_M.COG
#
# WEAPON 14 Script - Flash Bomb
#
# Functions kind of like the thermal detonator, except in that it creates a
# blinding flash instead of an explosion.
#
# - Not affected by MagSealed sectors/surfaces.
#
# [YB & CYW] + [RF]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# ========================================================================================
symbols
model povModel=flsv.3do local
model povModel_m=flsv_m.3do local
model weaponMesh=flsg.3do local
keyframe mountAnim=flsvmnt.key local
keyframe dismountAnim=flsvdis.key local
keyframe povFireAnim=flsvpst1.key local
keyframe prePOVThrowAnim=flsvpre1.key local
#keyframe preThrowAnim=kyrthro0.key local
keyframe holsterAnim=kyhlstr.key local
template projectile=+flashbomb1 local
template projectile1=+flashbomb2 local
template projectileB=+dudflash local
sound throwSound=ThermalThrow01.wav local
sound clickSound=ThermClick01.wav local
sound clickSound2=ThermClick02.wav local
sound loopSound=ThermLoop01.wav local
flex delayTime=1.0 local
flex throwWait=0.8 local
flex mountWait local
flex autoAimFOV=10 local
flex autoAimMaxDist=5 local
flex holsterWait local
thing player local
thing victim local
int preThrowTrack local
int selectTrack local
int prePOVThrowTrack local
int mode local
int cocked=0 local
int holsterTrack local
int selectMode=1 local
message startup
message activated
message deactivated
message selected
message deselected
message autoselect
message timer
message newplayer
message splash
message user0
end
# ========================================================================================
code
startup:
// Setup delays and variables.
mountWait = GetKeyLen(mountAnim);
preThrowTrack=-1;
selectTrack=-1;
prePOVThrowTrack=-1;
Return;
# ........................................................................................
activated:
player = GetSourceRef();
mode = GetSenderRef();
if (mode > 1)
Return;
PlaySoundThing(clickSound[mode], player, 1.0, -1.0, -1.0, 0x80);
// Cock arm back for throw.
if(preThrowTrack == -1 && prePOVThrowTrack == -1)
{
prePOVThrowTrack = jkPlayPOVKey(player, prePOVThrowAnim, 1, 0x14);
preThrowTrack = PlayMode( player, 38 );
ActivateWeapon(player, 0, mode);
}
Return;
# ........................................................................................
deactivated:
player = GetSourceRef();
mode = GetSenderRef();
delayTime = DeactivateWeapon(player, mode); // allow activated messages again.
// Don't throw if controls are disabled.
if (!(GetActorFlags(player) & 0x200000))
{
// Make sure both keys are up before continuing.
if (GetCurWeaponMode() != -1)
Return;
// Set maximum scale factor (2 second hold.)
if(delayTime > 2)
delayTime = 2;
// Restrict throw type.
mode = 1;
// Set minimum scale factor
if(mode == 0)
{
if(delayTime < 0.7) delayTime = 0.7;
}
else
{
if(delayTime < 0.25) delayTime = 0.25;
}
if(preThrowTrack != -1 && prePOVThrowTrack != -1)
{
jkStopPOVKey(player, prePOVThrowTrack, 0);
StopKey(player, preThrowTrack, 0);
preThrowTrack = -1;
prePOVThrowTrack = -1;
}
if (GetInv(player, 93))
{
mode = 2;
SendMessageEx(GetThingClassCog(player), skill, 1100, 0, 0, 0);
}
// Throw the appropriate detonator.
SetPOVShake('0.0 -.003 0.0', '0.5 0.0 0.0', .05, 40.0);
jkPlayPOVKey(player, povfireAnim, 1, 0x38);
PlaySoundThing(throwSound, player, 1.0, 0.5, 2.5, 0x80);
SendMessageEx(GetThingClassCog(GetLocalPlayerThing()), user1, 3, 0, 0, 0);
FireProjectile(player, projectile[mode], -1, 15, '0.05 0 0', '0 0 0', delayTime, 0x1, 0.0, 0.0);
ChangeInv(player, GetWeaponBin(14), -1.0);
SetMountWait(player, throwWait);
// If out of ammo try to autoswitch to another weapon
// if autoswitch is enabled else just switch to fists.
if(GetInv(player, GetWeaponBin(14)) < 1)
{
if(GetAutoSwitch() & 1)
{
SelectWeapon(player, GetWeaponBin(AutoSelectWeapon(player, 1)));
}
else
{
SelectWeapon(player, 1);
}
}
}
else
{
if(preThrowTrack != -1 && prePOVThrowTrack != -1)
{
jkStopPOVKey(player, prePOVThrowTrack, 0);
StopKey(player, preThrowTrack, 0);
preThrowTrack = -1;
prePOVThrowTrack = -1;
}
}
jkSetWaggle(player, '0.0 0.0 0.0', 0);
SetTimerEx(throwWait, 0, 0, 0);
Return;
# ........................................................................................
timer:
if (GetSenderId() == 0)
{
// Start waggling after the throw.
jkSetWaggle(player, '10.0 7.0 0.0', 350);
}
else
if (GetSenderId() == 2)
{
StopKey(player, holsterTrack, 0.0);
}
else
if (GetSenderId() == 11)
{
if(GetThingSignature(GetParam(1)) == GetParam(0))
ClearActorFlags(GetParam(1), 0x800);
}
Return;
# ........................................................................................
selected:
player = GetSourceRef();
jkSetWaggle(player, '10.0 7.0 0.0', 350);
// Play external mounting animation
PlayMode(player, 40);
// Setup the meshes and models.
if (GetInv(player, 67) == 0.0)
jkSetPOVModel(player, povModel); // Kyle hand
else
jkSetPOVModel(player, povModel_m); // Mara Hand
SetArmedMode(player, 0);
jkSetWeaponMesh(player, weaponMesh);
// Play the animation (NOLOOP + UNIQUE + ENDPAUSE).
// The animation is held at the last frame after it is played.
selectTrack = jkPlayPOVKey(player, mountAnim, 0, 0x14);
SetMountWait(player, GetKeyLen(mountAnim));
// Clear Lightsaber flag, and enable activation messages.
jkClearFlags(player, 0x5);
SetCurWeapon(player, GetWeaponBin(14));
SetMountWait(player, GetKeyLen(mountAnim));
Return;
# ........................................................................................
deselected:
player = GetSourceRef();
jkPlayPOVKey(player, dismountAnim, 0, 18);
holsterWait = GetKeyLen(holsterAnim);
SetMountWait(player, holsterWait);
holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
SetTimerEx(holsterWait, 2, 0.0, 0.0);
if(selectTrack != -1)
{
jkStopPOVKey(player, selectTrack, 0);
selectTrack = -1;
}
jkSetWaggle(player, '0.0 0.0 0.0', 0);
KillTimerEx(0);
if(preThrowTrack != -1 && prePOVThrowTrack != -1)
{
jkStopPOVKey(player, prePOVThrowTrack, 0);
StopKey(player, preThrowTrack, 0);
preThrowTrack = -1;
prePOVThrowTrack = -1;
}
Return;
# ........................................................................................
autoselect:
selectMode = GetSenderRef();
player = GetSourceRef();
// If the player has ammo
if(GetInv(player, GetWeaponBin(14)) != 0)
{
// query for ammo
if(selectMode == -1)
{
ReturnEx(399.0);
Return;
}
if((selectMode == 0) && !(GetAutoPickup() & 2))
{
ReturnEx(399.0);
Return;
}
if((selectMode == 1) && !(GetAutoSwitch() & 2))
{
ReturnEx(399.0);
Return;
}
if((selectMode == 2) && !(GetAutoPickup() & 2))
{
ReturnEx(399.0);
Return;
}
ReturnEx(-2.0);
Return;
}
else
{
ReturnEx(-1.0);
}
Return;
# ........................................................................................
newplayer:
if(preThrowTrack != -1 && prePOVThrowTrack != -1)
{
jkStopPOVKey(player, prePOVThrowTrack, 0);
StopKey(player, preThrowTrack, 0);
preThrowTrack = -1;
prePOVThrowTrack = -1;
}
Return;
# ........................................................................................
user0:
victim = GetParam(0);
SetActorFlags(victim, 0x800);
SetTimerEx(GetParam(1), 11, GetThingSignature(victim), victim);
return;
# ........................................................................................
end